#define _CRT_SECURE_NO_WARNINGS

#define offsetof(x,y)(x p;&p->y-&p)

#include<stdio.h>
#include<ctype.h>
int atoi(char* p)
{
	int i = 0;
	int ch = 0;
	while (isspace(p[i]) != 0)
	{
		i++;
	}
	if (p[i] == '-')
	{
		ch = '-';
		i++;
	}
	else if (p[i] == '+')
	{
		ch = '+';
		i++;
	}
	else if (isdigit(p[i]))
	{
		;
	}
	else
		return 0;
	int sum = 0;
	while (isdigit(p[i]) != 0)
	{
		sum = sum * 10 + (p[i] - '0');
		i++;
	}
	if (ch == '-')
		return -sum;
	else
		return sum;
}


int main()
{
	char p[20] = { "    -125364qw124" };
	int c=atoi(p);
	printf("%d ", c);
}